/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.model.impl;

import com.crossriver.crgis.database.model.Documents;
import com.crossriver.crgis.database.model.DocumentsModel;
import com.crossriver.crgis.database.model.DocumentsSoap;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;

/**
 * The base model implementation for the Documents service. Represents a row in the &quot;CRGIA_Documents&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.crossriver.crgis.database.model.DocumentsModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DocumentsImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a documents model instance should use the {@link com.crossriver.crgis.database.model.Documents} interface instead.
 * </p>
 *
 * @author Wole Adetiba
 * @see DocumentsImpl
 * @see com.crossriver.crgis.database.model.Documents
 * @see com.crossriver.crgis.database.model.DocumentsModel
 * @generated
 */
public class DocumentsModelImpl extends BaseModelImpl<Documents>
	implements DocumentsModel {
	public static final String TABLE_NAME = "CRGIA_Documents";
	public static final Object[][] TABLE_COLUMNS = {
			{ "documentId", new Integer(Types.VARCHAR) },
			{ "userId", new Integer(Types.VARCHAR) },
			{ "applicationId", new Integer(Types.VARCHAR) },
			{ "documentUpload", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table CRGIA_Documents (documentId VARCHAR(75) not null primary key,userId VARCHAR(75) null,applicationId VARCHAR(75) null,documentUpload VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table CRGIA_Documents";
	public static final String ORDER_BY_JPQL = " ORDER BY documents.documentId ASC";
	public static final String ORDER_BY_SQL = " ORDER BY CRGIA_Documents.documentId ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.crossriver.crgis.database.model.Documents"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.crossriver.crgis.database.model.Documents"),
			true);

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static Documents toModel(DocumentsSoap soapModel) {
		Documents model = new DocumentsImpl();

		model.setDocumentId(soapModel.getDocumentId());
		model.setUserId(soapModel.getUserId());
		model.setApplicationId(soapModel.getApplicationId());
		model.setDocumentUpload(soapModel.getDocumentUpload());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<Documents> toModels(DocumentsSoap[] soapModels) {
		List<Documents> models = new ArrayList<Documents>(soapModels.length);

		for (DocumentsSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.crossriver.crgis.database.model.Documents"));

	public DocumentsModelImpl() {
	}

	public String getPrimaryKey() {
		return _documentId;
	}

	public void setPrimaryKey(String pk) {
		setDocumentId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return _documentId;
	}

	public String getDocumentId() {
		if (_documentId == null) {
			return StringPool.BLANK;
		}
		else {
			return _documentId;
		}
	}

	public void setDocumentId(String documentId) {
		_documentId = documentId;
	}

	public String getUserId() {
		if (_userId == null) {
			return StringPool.BLANK;
		}
		else {
			return _userId;
		}
	}

	public void setUserId(String userId) {
		_userId = userId;
	}

	public String getApplicationId() {
		if (_applicationId == null) {
			return StringPool.BLANK;
		}
		else {
			return _applicationId;
		}
	}

	public void setApplicationId(String applicationId) {
		_applicationId = applicationId;
	}

	public String getDocumentUpload() {
		if (_documentUpload == null) {
			return StringPool.BLANK;
		}
		else {
			return _documentUpload;
		}
	}

	public void setDocumentUpload(String documentUpload) {
		_documentUpload = documentUpload;
	}

	public Documents toEscapedModel() {
		if (isEscapedModel()) {
			return (Documents)this;
		}
		else {
			return (Documents)Proxy.newProxyInstance(Documents.class.getClassLoader(),
				new Class[] { Documents.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		DocumentsImpl documentsImpl = new DocumentsImpl();

		documentsImpl.setDocumentId(getDocumentId());

		documentsImpl.setUserId(getUserId());

		documentsImpl.setApplicationId(getApplicationId());

		documentsImpl.setDocumentUpload(getDocumentUpload());

		return documentsImpl;
	}

	public int compareTo(Documents documents) {
		int value = 0;

		value = getDocumentId().compareTo(documents.getDocumentId());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Documents documents = null;

		try {
			documents = (Documents)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		String pk = documents.getPrimaryKey();

		if (getPrimaryKey().equals(pk)) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	public String toString() {
		StringBundler sb = new StringBundler(9);

		sb.append("{documentId=");
		sb.append(getDocumentId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", applicationId=");
		sb.append(getApplicationId());
		sb.append(", documentUpload=");
		sb.append(getDocumentUpload());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(16);

		sb.append("<model><model-name>");
		sb.append("com.crossriver.crgis.database.model.Documents");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>documentId</column-name><column-value><![CDATA[");
		sb.append(getDocumentId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>applicationId</column-name><column-value><![CDATA[");
		sb.append(getApplicationId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>documentUpload</column-name><column-value><![CDATA[");
		sb.append(getDocumentUpload());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private String _documentId;
	private String _userId;
	private String _applicationId;
	private String _documentUpload;
}